import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;


public class FrameHolder {
	private JFrame current;
	public Intro intro;
	public ConfigFrameM5 party;
	public StoreFrameM6 store;
	public JButton load;
	public JButton trail;
	public JButton continueTrail;
	public JButton returnBack;
	public JPanel buttons;

	public FrameHolder(){
		intro = new Intro();
		load =  (JButton)intro.getLoadButton();
		load.setVisible(true);
		ButtonListener listener = new ButtonListener();
		load.addActionListener(listener);
		trail  = (JButton)intro.getTrailButton();
		trail.addActionListener(listener);
		trail.setVisible(true);
		party = new ConfigFrameM5();
		intro.setVisible(true);
		//party.setVisible(false);
		continueTrail = (JButton)party.getContinue();
		continueTrail.addActionListener(listener);
		String[] names={"Chris", "Amy", "Akbar", "Adiyta"};
		WagonController wagC=new WagonController("Bare Bones", names, Pace.Steady, "Solace", Profession.BANKER);
		store = new StoreFrameM6();
		store.setVisible(true);
		current = intro;
		//returnBack = store.getReturn();
		//returnBack.addActionListener(listener);

	}
	
	
	public static void main(String[] args){
		new FrameHolder();

	}
	

	
	private class ButtonListener implements ActionListener{
		public void actionPerformed(ActionEvent e){
			if(e.getSource() == load)
			System.out.println("load clicked");
			if(e.getSource()== trail){
				load.doClick(10);
				party.setVisible(true);
				current.setVisible(false);
				current = party;
			}
			if(e.getSource()== continueTrail){
				store.setVisible(true);
				current.setVisible(false);
				current = store;
			}
			if(e.getSource()== returnBack){
				current.setVisible(false);
				party.setVisible(true);
				current = party;
			}
		}
	}
}
